<?php

namespace App\Controller;

use App\JsonRpc\Consumer\CalculatorServiceInterface;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\AutoController;

/**
 * @AutoController(prefix="/jsonrpc")
 */
class JsonRpcController extends AbstractController
{
    /**
     * @Inject()
     * @var CalculatorServiceInterface
     */
    private $calculatorService;

    public function index()
    {
        $a = $this->request->input('a');
        $b = $this->request->input('b');

        return $this->calculatorService->add($a, $b);
    }
}